##urllib库和request库的相关功能测试和瓜子网抽取

import urllib.request

response = urllib.request.urlopen('https://bj.fang.com/quanwangso/search.html?city=bj&refer=sy_seach')
print(response.getheaders())
print(response.getcode())
print(response.readlines())

import requests
r = requests.get('https://www.guazi.com/bj/buy/')
print(r.text)

items=$("div.screen div.clearfix a").find("a");
for(var i in items){
    console.log(items[i]["innerText"]);
    console.log(items[i]["href"]);
    }
from pyquery import PyQuery as pq
import requests
doc = pq(requests.get('https://www.guazi.com/bj/buy/').text)
lis = doc('div.screen div.clearfix a')
for a in lis.items():
    print(a.text())
    print(a.attr.href)
